(function(){
        var myChart=echarts.init(document.getElementById('right1'));
        var option = {
        	      title: {text: '历年收缴率',
                         textStyle: {color:"#21e6c1",fontSize: 18,fontFamily:"楷体"},
            left:'12%',
            top:'5%'
                         },
        	      grid: {left:'5%',
                         right:'5%',
                         top:'20%',
                         bottom:'5%',
                         containLabel:true
                         },
                   tooltip: {
                             trigger: 'axis',
                             axisPointer: {            // 坐标轴指示器，坐标轴触发有效
                                   type: 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
                                          }
                             },
                  xAxis: {
                      type: 'category',
                      data: [],
                      axisLabel:{fontSize: 8,color:"white"},
                      splitLine:{show: false},
                          },
                  yAxis: {
                      type: 'value',
                      splitLine:{show: false},
                      axisLabel:{fontSize: 8,color:"white"},
                          },
                  series: [{
                  	  name: '收缴率',
                      data: [],
                      type: 'line',
                      itemStyle: {normal: {label: {
                            show: true,
                            formatter: function (params) {
                                return (params.value * 100).toFixed(2) + '%'; // 将值转换为百分比并保留两位小数
                            },
                                  position: 'top',textStyle: {color: "white",fontSize: 8}},
                                 color:"#43dde6"}
                        }
                         } ]
                     };

        function get_json_bar() {
    $.ajax({
        url: 'http://localhost:5000/right1',
        type: 'GET',
        success: function (e) {
        option.xAxis.data = e.map(subArray => subArray[0]);
        option.series[0].data = e.map(subArray => subArray[1]);
        myChart.setOption(option);
        setTimeout(get_json_bar,10000)
                               }
            });
}
//执行函数
get_json_bar();

          myChart.setOption(option);
})();